Skip to content

chore(ci): route backports through verified pr metadata - #4264

Open
Piotr1215 wants to merge 8 commits into
mainfrom
devops-1803/pr-event-migration
Open

Piotr1215 wants to merge 8 commits into
mainfrom
devops-1803/pr-event-migration

Conversation

@Piotr1215

@Piotr1215 Piotr1215 commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

What issue type does this pull request address? (keep at least one, remove the others)
/kind bugfix

What does this pull request do? Which issues does it resolve? (use resolves #<issue_number> if possible)
Remove privileged PR triggers from every workflow. Use an unprivileged, no-op pull_request label signal and trusted default-branch consumers that resolve merged PRs from GitHub's API. Merges use push; labels added after merge use workflow_run, avoiding duplicate close-event backports.

Give code-running PR jobs read-only tokens and disable stored checkout credentials. Gate jobs that need secrets, OIDC or write access on the PR head repository matching this repository. Same-repository PRs retain their CI and automation. Pin Helm 3 for the existing chart test plugin and retain the four workspace metadata files produced by go mod vendor, so the required checks can run on current tooling without relaxing them.

Closes DEVOPS-1803

Please provide a short message that should be published in the vcluster release notes
Keep automatic backports running through an unprivileged PR signal and verified merged PR metadata.

What else do we need to know?

The shared resolver and reusable backport workflow are published from loft-sh/github-actions#349 as resolve-pr-event/v1 and backport/v2. The reusable workflow uses resolve-pr-event/v1 internally. That shared resolver verifies the run's head_repository.full_name against the API-fetched PR's head.repo.full_name, as well as the workflow identity, branch, SHA, attempt, merge state and default-branch ancestry. No policy exception for privileged PR events is needed.

Stage Trigger and reads Mutations Result and skip remedy
Signal PR label event; no checkout, secrets or artifacts None A completed run wakes the consumer. Conflicted PR signals may be absent; merged PRs also reach the push path.
Resolve Default-branch push or successful PR signal; authoritative GitHub run and merged PR APIs None A matrix of verified merged PR envelopes. Unmerged, replayed and mismatched runs skip with a resolver warning.
Backport Each verified PR; shared workflow revalidates its envelope Existing backport branch/PR creation and optional Linear linking Existing per-PR serialization and backport status reporting remain. The shared resolver tag is published.

The read-only token, API validation, default-branch checks and shared resolver replay tests cover the privilege boundary. The new local workflow contract tests guard the signal, published references, matrix handoff and fork job permissions. Existing shared backport actions own mutations and status comments; no new service or alert route is added.

Validation: five workflow contract tests pass; actionlint passes with a narrow ignore for the pre-existing cache-mode key unsupported by local actionlint v1.7.12; offline zizmor reports zero dangerous-triggers findings, with fewer existing permission/checkout findings. The retained cache-mode: none is valid GitHub workflow syntax. Helm tests pass all 238 tests in 21 suites. ./hack/test.sh passed the Go build, race tests and coverage checks. The full custom ./tools/golangci-lint run --timeout 15m -- ./... passed with 0 issues after rebuilding with the Go version from go.mod. A clean local go mod tidy && go mod vendor reproduced the four workspace files reported by CI, with no change to go.mod or go.sum; those generated files are now committed. go list -mod=vendor ./... passes. The chart job now pins Helm v3.22.1 because the runner default requires plugin verification unsupported by the existing helm-unittest v0.4.4 plugin. Final CI for 73279ec1db29db168fb4f984d116d4e67e894149: 19 successful checks and 2 expected skips; all workflow runs completed, including the code-triggered Ginkgo run and install/upgrade checks. Live post-merge backport acceptance remains pending rollout. The matching monorepo staging patch will be handed to the owner of vcluster-pro#2695.

E2E Tests

Default Test Execution

The mandatory PR suite runs automatically. Only specify additional test suites below if needed.

Adding New Test Suites

When adding a new ginkgo test suite:

  • Add labels to the test suite
  • Update label-filter section below to execute the new test suite
  • Verify test suite runs in CI/CD pipeline

Additional test suites

Additional test suite(s) that will be executed before the mandatory PR suite:

none

Public backport automation loses its default event allowance on 2 December. A read-only metadata relay preserves fork and conflicted PR events while the shared backport workflow consumes a validated payload.
@Piotr1215
Piotr1215 requested a review from a team as a code owner November 4, 2026 15:21
The new workflow_run caller must explicitly cap cache access for its reusable workflow. CI rejected the inherited cache mode because the callee could request writes beyond the low-trust trigger default.
@github-actions

github-actions Bot commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

E2E Ginkgo Tests

Status Commit Run
Passed 19631173e9eb54b6d45a57b76178e0627ade30ee View run #43005390273

Public PR automation must keep working without an exception for privileged PR triggers. The metadata relay still required that exception and CI jobs relied on repository settings to strip fork privileges.

Use a no-op label signal and API-verified trusted push or workflow-run consumers. Restrict secret and write jobs to same-repository PRs, keep fork code jobs read-only, and test those trust boundaries.
@Piotr1215
Piotr1215 requested review from a team as code owners November 5, 2026 12:58
The runner Helm now requires plugin verification, so the existing helm-unittest v0.4.4 install fails before any chart tests run. Keep chart verification on the same Helm 3 version already used by the e2e workflows.
Go 1.26.10 copies four upstream OpenAPI workspace files into vendor. Their omission makes the repository consistency check fail before lint can run, even though the module graph and checksums stay unchanged.
The shared resolver now binds signal runs to the original fork repository and avoids repeated push-range discovery when trusted jobs restore an already selected event. Both entry points need the same reviewed revision until the shared release is published.
The shared prerequisite completed its final review and test round. Keep this consumer on that exact revision until the resolver tag is published so rollout cannot pick up an earlier candidate.
Backport automation depends on a release candidate that is no longer the published integration point. The published tags allow the supported resolver and reusable workflow to receive coordinated updates.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant